#ifndef MOUSEFILTER_H
#define MOUSEFILTER_H
#include <QEvent>
#include <QObject>
#include <QDebug>
class MouseFilter : public QObject {
    Q_OBJECT
public:
    explicit MouseFilter(QObject *parent);
signals:
    void mouseEventReceived(QEvent *event);
protected:
    bool eventFilter(QObject *obj, QEvent *event) override {
        if (event->type() == QEvent::MouseButtonPress||
            event->type() == QEvent::MouseButtonRelease ||
            event->type() == QEvent::MouseMove) {
            // 在这里处理鼠标事件，可以根据需要进行相应的处理
            emit mouseEventReceived(event);
        }
        // 将事件传递给父对象
        return QObject::eventFilter(obj, event);
    }
};

#endif // MOUSEFILTER_H
